package com.anivia.system.auth.model.dto;

import com.anivia.common.core.enums.DataScopeEnum;
import com.anivia.common.core.enums.DesensitizedTypeEnum;
import com.anivia.system.auth.enums.SwitchStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 角色
 * </p>
 *
 * @author wangj
 */
@Data
@Schema
public class RoleAddOrUpdateDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "id，更新时必传，新增时不传")
    private Integer id;

    @Schema(description = "名称")
    @NotBlank(message = "名称不能为空")
    private String name;

    @Schema(description = "角色id")
    @NotNull(message = "角色id不能为空")
    private Integer roleId;

    @Schema(description = "描述")
    private String description;

    @Schema(description = "状态")
    @NotNull(message = "状态不能为空")
    private SwitchStatusEnum status;

    @Schema(description = "脱敏字段")
    private List<DesensitizedTypeEnum> desensitizationField;

    @Schema(description = "资源权限")
    private List<ResourceItemVO> permission;


    @AllArgsConstructor
    @Data
    public static class ResourceItemVO {
        @Schema(description = "资源id")
        private Integer resourceId;

        @Schema(description = "数据权限")
        private DataScopeEnum dataScope;

        @Schema(description = "自定义部门id")
        private List<Integer> customDeptIds;
    }
}
